﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace Code4WP7SDK
{
    public interface IMckTrain
    {
        /// <summary>
        /// 简单注册
        /// </summary>
        /// <typeparam name="TMessage"></typeparam>
        /// <param name="taker"></param>
        /// <param name="action"></param>
        void Regist<TMessage>(object taker, Action<TMessage> action);
        /// <summary>
        /// 带有标示的注册
        /// </summary>
        /// <typeparam name="TMessage"></typeparam>
        /// <param name="taker"></param>
        /// <param name="token"></param>
        /// <param name="action"></param>
        void Regist<TMessage>(object taker, object token, Action<TMessage> action);
        /// <summary>
        /// 注册继承自同一个接口或者父类
        /// </summary>
        /// <typeparam name="TMessage"></typeparam>
        /// <param name="taker"></param>
        /// <param name="receiveDeriveMessageToo"></param>
        /// <param name="action"></param>
        void Regist<TMessage>(object taker, bool receiveDeriveMessageToo, Action<TMessage> action);
        /// <summary>
        /// 带有表示同时
        /// 注册继承自同一个接口或者父类
        /// </summary>
        /// <typeparam name="TMessage"></typeparam>
        /// <param name="taker"></param>
        /// <param name="token"></param>
        /// <param name="receiveDeriveMessageToo"></param>
        /// <param name="action"></param>
        void Regist<TMessage>(object taker, object token, bool receiveDeriveMessageToo, Action<TMessage> action);

        /// <summary>
        /// 发送消息
        /// </summary>
        /// <typeparam name="TMessage"></typeparam>
        /// <param name="message"></param>
        void Send<TMessage>(TMessage message);
        /// <summary>
        /// 向指定的目标发送消息
        /// </summary>
        /// <typeparam name="TMessage"></typeparam>
        /// <typeparam name="TTarget"></typeparam>
        /// <param name="message"></param>
        void Send<TMessage, TTarget>(TMessage message);
        /// <summary>
        /// 向注册指定标示的Taker发送信息
        /// </summary>
        /// <typeparam name="TMessage"></typeparam>
        /// <param name="message"></param>
        /// <param name="token"></param>
        void Send<TMessage>(TMessage message, object token);

        /// <summary>
        /// 取消注册
        /// </summary>
        /// <param name="taker"></param>
        void UnRegist(object taker);
        /// <summary>
        /// 取消注册某个消息
        /// </summary>
        /// <typeparam name="TMessager"></typeparam>
        /// <param name="taker"></param>
        void UnRegist<TMessage>(object taker);
        /// <summary>
        /// 取消注册某个标示的某个信息
        /// </summary>
        /// <typeparam name="TMessage"></typeparam>
        /// <param name="taker"></param>
        /// <param name="token"></param>
        void UnRegist<TMessage>(object taker, object token);
        /// <summary>
        /// 取消注册某种消息的某个操作
        /// 其他关于这种消息的操作没有被取消注册
        /// </summary>
        /// <typeparam name="TMessage"></typeparam>
        /// <param name="taker"></param>
        /// <param name="message"></param>
        void UnRegist<TMessage>(object taker, Action<TMessage> action);
        /// <summary>
        /// 取消带有标示的该种消息的操作(更细粒度的)
        /// </summary>
        /// <typeparam name="TMessage"></typeparam>
        /// <param name="taker"></param>
        /// <param name="token"></param>
        /// <param name="message"></param>
        void UnRegist<TMessage>(object taker, object token, Action<TMessage> action);
    }
}
